package com.socket.server;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;


public class MyTextLinerFactory implements ProtocolCodecFactory{

    private MyTextDecoder decoder;
    private MyTextLineCumulativeDecoder cumulativeDecoder;
    private MyTextEncoder encoder;

    public MyTextLinerFactory(){
        decoder = new MyTextDecoder();
        encoder = new MyTextEncoder();
        cumulativeDecoder = new MyTextLineCumulativeDecoder();
    }


    @Override
    public ProtocolEncoder getEncoder(IoSession session) throws Exception {
        return encoder;
    }

    @Override
    public ProtocolDecoder getDecoder(IoSession session) throws Exception {
        return cumulativeDecoder;
    }
}
